package com.zzw.test.spring;

import com.zzw.spring.model.User;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest2 {

	public static void main(String[] args) {
		String path = "classpath:spring-test.xml";
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(path);
		User user = User.class.cast(context.getBean("user_cp"));
		System.out.println(user);
		ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
		BeanDefinition beanDefinition = beanFactory.getBeanDefinition("user_cp");
		System.out.println(beanDefinition.getBeanClassName());
		String[] aliases = beanFactory.getAliases("user");
		System.out.println(aliases);
	}
}
